package cn.wolfcode.wolf2w.service.impl;



@Service
public class ${type}ServiceImpl implements I${type}Service {
    @Autowired
    private ${type}Repository ${name}Repository;


    @Override
    public void insert(${type} ${name}) {
        ${name}Repository.save(${name});
    }

    @Override
    public void delete(String id) {
        ${name}Repository.deleteById(id);
    }

    @Override
    public void update(${type} ${name}) {
        ${name}Repository.save(${name});
    }

    @Override
    public ${type} findById(String id) {
        Optional<${type}> ${name} = ${name}Repository.findById(id);
        return ${name}.orElse(null);
    }

    @Override
    public List<${type}> findAll() {
        List<${type}> all = ${name}Repository.findAll();
        return all;
    }


}
